<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //内置构造函数创建数组
      var arr = new Array()
      console.log(arr)
      //传参一个 new Array(6) 会创建一个长度为6的空数组
      var arr = new Array(6)
      console.log(arr)
      //传入多个参数会被当成键值
      var arr = new Array(6, 7, 8, 9) //[6,7,8,9]
      console.log(arr)
      var arr = ['张三', '李四', '王五'] //一维数组
      var arr = ['张三',['李四','王五']] //二维数组
      //  数组的扁平化 (降维)

      var arr = [1,2,[3,[4,[5,[6]]]]];
      //1、把数组转为字符串
      var str = arr.toString()
      console.log(str)
      //2、把字符串转为数组  可以根据某个字符把字符串切割成数组
      //var 数组 字符串.split('分割的字符')
//       var str = 'a-b-c-d'
//       var aarr= str.split('-')

// console.log(aarr);

 var newarr = str.split(',')
 console.log(newarr);
    </script>
  </body>
</html>
